package com.qf.aop;

import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;

/**
 * 环绕通知: 中间执行业务代码, 前后都可以插入辅助功能
 * @author 千锋健哥
 */
public class MyAround implements MethodInterceptor {

    @Override
    public Object invoke(MethodInvocation methodInvocation) throws Throwable {
        //额外功能
        System.out.println("======开启事务========");

        //核心功能
        Object proceed = methodInvocation.proceed();

        //额外功能
        System.out.println("=======关闭事务===========");
        return proceed;
    }

}
